import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/video_geturl_entity.dart';

VideoGeturlEntity $VideoGeturlEntityFromJson(Map<String, dynamic> json) {
  final VideoGeturlEntity videoGeturlEntity = VideoGeturlEntity();
  final VideoGeturlVodPlayInfo? vodPlayInfo = jsonConvert.convert<
      VideoGeturlVodPlayInfo>(json['vod_play_info']);
  if (vodPlayInfo != null) {
    videoGeturlEntity.vodPlayInfo = vodPlayInfo;
  }
  final double? duration = jsonConvert.convert<double>(json['duration']);
  if (duration != null) {
    videoGeturlEntity.duration = duration;
  }
  return videoGeturlEntity;
}

Map<String, dynamic> $VideoGeturlEntityToJson(VideoGeturlEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['vod_play_info'] = entity.vodPlayInfo?.toJson();
  data['duration'] = entity.duration;
  return data;
}

extension VideoGeturlEntityExtension on VideoGeturlEntity {
  VideoGeturlEntity copyWith({
    VideoGeturlVodPlayInfo? vodPlayInfo,
    double? duration,
  }) {
    return VideoGeturlEntity()
      ..vodPlayInfo = vodPlayInfo ?? this.vodPlayInfo
      ..duration = duration ?? this.duration;
  }
}

VideoGeturlVodPlayInfo $VideoGeturlVodPlayInfoFromJson(
    Map<String, dynamic> json) {
  final VideoGeturlVodPlayInfo videoGeturlVodPlayInfo = VideoGeturlVodPlayInfo();
  final String? backupPlayUrl = jsonConvert.convert<String>(
      json['BackupPlayUrl']);
  if (backupPlayUrl != null) {
    videoGeturlVodPlayInfo.backupPlayUrl = backupPlayUrl;
  }
  final int? bitrate = jsonConvert.convert<int>(json['Bitrate']);
  if (bitrate != null) {
    videoGeturlVodPlayInfo.bitrate = bitrate;
  }
  final String? codec = jsonConvert.convert<String>(json['Codec']);
  if (codec != null) {
    videoGeturlVodPlayInfo.codec = codec;
  }
  final String? definition = jsonConvert.convert<String>(json['Definition']);
  if (definition != null) {
    videoGeturlVodPlayInfo.definition = definition;
  }
  final double? duration = jsonConvert.convert<double>(json['Duration']);
  if (duration != null) {
    videoGeturlVodPlayInfo.duration = duration;
  }
  final String? fileId = jsonConvert.convert<String>(json['FileId']);
  if (fileId != null) {
    videoGeturlVodPlayInfo.fileId = fileId;
  }
  final String? fileType = jsonConvert.convert<String>(json['FileType']);
  if (fileType != null) {
    videoGeturlVodPlayInfo.fileType = fileType;
  }
  final String? format = jsonConvert.convert<String>(json['Format']);
  if (format != null) {
    videoGeturlVodPlayInfo.format = format;
  }
  final int? height = jsonConvert.convert<int>(json['Height']);
  if (height != null) {
    videoGeturlVodPlayInfo.height = height;
  }
  final String? mainPlayUrl = jsonConvert.convert<String>(json['MainPlayUrl']);
  if (mainPlayUrl != null) {
    videoGeturlVodPlayInfo.mainPlayUrl = mainPlayUrl;
  }
  final String? md5 = jsonConvert.convert<String>(json['Md5']);
  if (md5 != null) {
    videoGeturlVodPlayInfo.md5 = md5;
  }
  final String? quality = jsonConvert.convert<String>(json['Quality']);
  if (quality != null) {
    videoGeturlVodPlayInfo.quality = quality;
  }
  final int? size = jsonConvert.convert<int>(json['Size']);
  if (size != null) {
    videoGeturlVodPlayInfo.size = size;
  }
  final dynamic volume = json['Volume'];
  if (volume != null) {
    videoGeturlVodPlayInfo.volume = volume;
  }
  final int? width = jsonConvert.convert<int>(json['Width']);
  if (width != null) {
    videoGeturlVodPlayInfo.width = width;
  }
  return videoGeturlVodPlayInfo;
}

Map<String, dynamic> $VideoGeturlVodPlayInfoToJson(
    VideoGeturlVodPlayInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['BackupPlayUrl'] = entity.backupPlayUrl;
  data['Bitrate'] = entity.bitrate;
  data['Codec'] = entity.codec;
  data['Definition'] = entity.definition;
  data['Duration'] = entity.duration;
  data['FileId'] = entity.fileId;
  data['FileType'] = entity.fileType;
  data['Format'] = entity.format;
  data['Height'] = entity.height;
  data['MainPlayUrl'] = entity.mainPlayUrl;
  data['Md5'] = entity.md5;
  data['Quality'] = entity.quality;
  data['Size'] = entity.size;
  data['Volume'] = entity.volume;
  data['Width'] = entity.width;
  return data;
}

extension VideoGeturlVodPlayInfoExtension on VideoGeturlVodPlayInfo {
  VideoGeturlVodPlayInfo copyWith({
    String? backupPlayUrl,
    int? bitrate,
    String? codec,
    String? definition,
    double? duration,
    String? fileId,
    String? fileType,
    String? format,
    int? height,
    String? mainPlayUrl,
    String? md5,
    String? quality,
    int? size,
    dynamic volume,
    int? width,
  }) {
    return VideoGeturlVodPlayInfo()
      ..backupPlayUrl = backupPlayUrl ?? this.backupPlayUrl
      ..bitrate = bitrate ?? this.bitrate
      ..codec = codec ?? this.codec
      ..definition = definition ?? this.definition
      ..duration = duration ?? this.duration
      ..fileId = fileId ?? this.fileId
      ..fileType = fileType ?? this.fileType
      ..format = format ?? this.format
      ..height = height ?? this.height
      ..mainPlayUrl = mainPlayUrl ?? this.mainPlayUrl
      ..md5 = md5 ?? this.md5
      ..quality = quality ?? this.quality
      ..size = size ?? this.size
      ..volume = volume ?? this.volume
      ..width = width ?? this.width;
  }
}